package com.deram.ctin.serv.business.impl;

import com.deram.ctin.serv.business.api.BusinessInfoApi;
import com.deram.ctin.serv.business.entity.BaseUpdateInfo;
import com.deram.ctin.serv.business.entity.BusinessInfo;
import com.deram.ctin.serv.business.filter.BusinessInfoFilter;
import com.deram.ctin.serv.business.service.BusinessInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: jtt
 * @Description:
 * @Date: 2017/9/13 15:58
 * @version: V1.0
 */
@RestController
public class BusinessInfoApiImpl implements BusinessInfoApi {

    @Autowired
    BusinessInfoService businessInfoService;

    @Override
    public BusinessInfo find(@RequestParam("enterId") Long enterId) {
        return businessInfoService.find(enterId);
    }

    @Override
    public BusinessInfo findByYear(@RequestParam("enterId") Long enterId, @RequestParam("year") Integer year) {
        return businessInfoService.findByYear(enterId, year);
    }

    @Override
    public List<BusinessInfo> list(@RequestBody BusinessInfoFilter filter) {
        return businessInfoService.list(filter);
    }

    @Override
    public BusinessInfo save(@RequestBody BusinessInfo param) {
        return businessInfoService.save(param);
    }

    @Override
    public void insertList(@RequestBody BaseUpdateInfo<BusinessInfo> param) {
        businessInfoService.insertList(param.getList());
    }

    @Override
    public void delete(@RequestParam("enterId") Long enterId) {
        businessInfoService.delete(enterId);
    }

    @Override
    public List<Integer> listYear(Long enterId) {
        return businessInfoService.listYear(enterId);
    }
}
